package cn.jbolt.ai.app.controller;



import cn.jbolt.ai.app.entity.AiAppDesign;
import cn.jbolt.ai.app.service.AiAppDesignService;
import cn.jbolt.util.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * AI应用设计管理
 */
@Controller
@ResponseBody
@RequestMapping("/aiAppDesign")
@Tag(name = "AI应用设计管理Controller")
public class AiAppDesignController {

    @Autowired
    private AiAppDesignService designService;

    @Operation(summary = "根据ID获取设计信息", description = "根据ID获取设计信息")
    @GetMapping("/getById/{id}")
    public Result getById(@PathVariable Long id) {
        return designService.getDesignById(id);
    }



    @Operation(summary = "添加新的设计", description = "添加新的设计")
    @PostMapping("/add")
    public Result add(@RequestBody AiAppDesign design) {
        return designService.add(design);
    }

    @Operation(summary = "更新设计信息", description = "更新设计信息,fieldsName:字段名称,fieldsValue:字段值")
    @PostMapping("/update")
    public Result update(@RequestBody AiAppDesign design) {

        return designService.update(design);
    }

    @Operation(summary = "删除设计", description = "删除设计")
    @GetMapping("/del/{id}")
    public Result del(@PathVariable Long id) {
        return designService.del(id);
    }
    @Operation(summary = "试运行设计", description = "试运行设计")
    @GetMapping("/testRun/{id}")
    public Result testRun(@PathVariable Long id) {
        return designService.testRun(id);
    }

    @Operation(summary = "应用发布", description = "应用发布")
    @GetMapping("/publish/{id}")
    public Result publish(@PathVariable Long id) {
        return designService.publish(id);
    }
}
